<?php
$this->load->model('sGlobal_model');
?>
<script type="text/javascript" src="<?php echo base_url(); ?>static/select2/select2.min.js" ></script>
<script type="text/javascript" src="<?php echo base_url(); ?>static/js/selectSearchGlobal.js"></script>
<!--
<link type="text/css" href="<?php echo base_url(); ?>ajaxupload/ajaxfileupload.css" rel="stylesheet" /> 
<script src="<?php echo base_url(); ?>ajaxupload/jquery.js" type="text/javascript"></script>
<script src="<?php echo base_url(); ?>ajaxupload/ajaxfileupload.js" type="text/javascript"></script>
-->

<script>
    function appGaSave() {
        $.post("<?= site_url() ?>search_global/app_gaSave", {
            pCTab: $('#pCTab').val(),
            pCType: $('#pCType').val(),
            pCtrlID: $('#pCtrlID').val(),
            pApproval: $('#pApproval').val(),
            pNikRequestBy: $('#pNikRequestBy').val(),
            pComment: $('#pComment').val(),
            pFollowUp: $('#pFollowUp').val(),
        },
        function(data) {
            window.location = '<?php echo base_url(); ?>search_global';
        }
        );
    }
    function cancel(){
        window.location = '<?php echo base_url(); ?>search_global';
    }
</script>


<?php 
	foreach($getDetail as $a){
	    $aPoboxRelatedTo  	= $a["POBOX_RELATEDTO"];
		$aPoboxId  			= $a["POBOX_ID"];
		$aPoboxNip  		= $a["POBOX_NIP"];
		$aPoboxNikAtasan  	= $a["POBOX_ATASAN_NIK"];
		$aPoboxType 		= $a["POBOX_TYPE"];
		$aPoboxSubject 		= $a["POBOX_SUBJECT"];
		$aPoboxDescription  = $a["POBOX_DESCRIPTION"];
		$aTypeId  			= $a["TYPE_ID"];
		$aTypeDesc  		= $a["MST_TYPE_DESC"];	
		$aPoboxUntukNik  	= $a["POBOX_UNTUK_NIK"];
		
		$cName				= $a["NIKNAME"];
		$cJob				= $a["NIKJOBPOSITION"];
		$cOrg				= $a["NIKORG"];
		$cNameAtasan		= $a["ATASANNAME"];
		
		if(	$aPoboxType == 'KELUHAN'){
			$vPoboxTypeKel = "selected";
		}
		if(	$aPoboxType == 'SARAN'){
			$vPoboxTypeSar = "selected";
		}
 	}
    /*
	if(empty($org)){
		   $org = dbora_getorg("$nik");
	}*/
?>

<div id="top" >
<form id="formarea" role="form" method="post" action="" class="form-horizontal"  enctype="multipart/form-data"> 
    <input type="hidden" value="<?php echo $cRequestNo; ?>" id="pCtrlID" />
    <input type="hidden" value="<?php echo $cTab; ?>" id="pCTab" />
    <input type="hidden" value="<?php echo $cType; ?>" id="pCType" />
    <input type="hidden" value="<?php echo $aPoboxUntukNik;?>" id="pNikRequestBy" name="pNikRequestBy"/>
    <input type="hidden" value="<?php echo $sesNik;?>" id="pNik" name="pNik"/>
    
    
    <div class="col-md-11">
			<div class="panel panel-default">
				<div class="panel-heading">
					<h4 class="panel-title"><b class="caret"></b><b> Request By</b></h4>
				</div>
				<div class="panel-body">
					<div class="col-xs-12 col-sm-6 col-md-6">
						<div class="form-group">
							<label class="control-label col-md-3">Name</span></label>
							<div class="col-md-7">
                            <input type="hidden" value="<?php echo $cName;?>" id="r_nama" class="select2 form-control input-sm" readonly=""/>
                            <input type="hidden" value="<?php echo $aPoboxNikAtasan;?>" id="r_mgrid" class="select2 form-control input-sm" readonly=""/>
                            <input type="hidden" value="<?php echo $cNameAtasan;?>" id="r_mgr" class="select2 form-control input-sm" readonly=""/>
                            
                            <input type="text" id="r_nameA" class="select2 form-control input-sm" value="<?php echo $cName;?>" readonly=""/>
                            </div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-3">ID Number</label>
							<div class="col-md-4">
							<input type="text" value="<?php echo $aPoboxUntukNik;?>" id="r_id" class="form-control input-sm" readonly=""/> 
							<!-- Edit by Andi Siswanto ~ before id="r_nik" -->
							</div> 
						</div>
					</div>
					<div class="col-xs-6 col-sm-6 col-md-6">
						<div class="form-group">
							<label class="control-label col-md-4">Departement</label>
							<div class="col-md-7">
							<input type="text" value="<?php echo $cOrg;?>" id="r_dept" class="form-control input-sm" readonly=""/>
							<!-- Edit by Andi Siswanto ~ before id="r_department" -->
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-4">Job Position</label>
							<div class="col-md-8">
							<input type="text" value="<?php echo $cJob;?>" id="r_job" class="form-control input-sm" readonly=""/>
							</div>
						</div>
					</div>
				</div>
			</div>
            
            
			<div class="panel panel-default">
				<div class="panel-heading"><h4 class="panel-title"><b class="caret"></b><b> Form</b></h4></div>
				<div class="panel-body">
					<div class="col-sm-6 col-md-6">
						<div class="form-group">
							<label class="col-md-4">Criteria</label>
							<div class="col-md-4">
                                <select id="pCriteria" class="form-control input-sm" readonly=""> 
                                    <option value="KELUHAN" <?php if($aPoboxType=="KELUHAN"){?>selected=""<?php }?>>Keluhan</option>
									<option value="SARAN" <?php if($aPoboxType=="SARAN"){?>selected=""<?php }?>>Saran</option> 
								</select>
							</div>
						</div>
                        <div class="form-group">
							<label class="col-md-4">Related To</label>
							<div class="col-md-7">
								<input type="text" id="r_relatednameA" class="form-control input-sm" value="<?php echo $aPoboxRelatedTo;?>" readonly=""/>
                                <input type="hidden" value="<?php echo $aPoboxRelatedTo;?>" id="r_relatedid" class="form-control input-sm" readonly="" />
							</div>		
						</div>
                        <div class="form-group">
							<label class="col-md-4">Subject</label>
							<div class="col-md-5">
								<input type="text" value="<?php echo $aPoboxSubject;?>" id="pSubject" class="form-control input-sm" readonly=""/>
							</div>		
						</div>
                        <div class="form-group">
							<label class="col-md-4">Follow Up</label>
							<div class="col-md-5">
								<textarea id="pFollowUp" class="form-control input-sm" style="min-width:190px;max-width:300px;min-height:100px;max-height:200px;">
                                </textarea>
							</div>		
						</div>
                        <div class="form-group">
							<label class="col-md-4">Approval</label>
							<div class="col-md-5">
								<select class="form-control input-form select2" id="pApproval" style="width:100%">
                            			<option value="Y">Approve</option>
                                        <option value="N" selected="">Disapprove</option>
    				            </select>
							</div>		
						</div>
                        <div class="form-group">
							<label class="col-md-4">Comment</label>
							<div class="col-md-5">
								<textarea id="pComment" class="form-control input-sm" style="min-width:190px;max-width:300px;min-height:100px;max-height:200px;">
                                </textarea>
							</div>		
						</div>
					</div>
                    
					<div class="col-sm-6 col-md-6">
						<div class="form-group">
							<label class="col-md-5">Type</span></label>
							<div class="col-md-7"> 
                                <select id="pType" class="form-control input-sm" readonly=""> 
                                    <?php
                                        foreach($getType as $z){
                                            $zMstTypeId   	= $z["MST_TYPE_ID"];
											$zMstTypeDesc  	= $z["MST_TYPE_DESC"];
                                            ?>
                                            <option value="<?php echo $zMstTypeId;?>" <?php if($aTypeId==$zMstTypeId){?>selected=""<?php } ?>><?php echo $zMstTypeDesc;?></option>
                                            <?php
                                        }
                                    ?>
								</select>
							</div>
						</div>
						<div class="form-group">
							<label class="col-md-4">Description</span></label>
							<div class="col-md-8">
								<textarea id="pDescription" class="form-control input-sm" style="min-width:190px;max-width:300px;min-height:100px;max-height:200px;" readonly=""><?php echo $aPoboxDescription;?>
                                </textarea>
							</div>
						</div>
					</div>
                    
					<div class="row"> 
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="control-label col-md-3"></label>
        						<div class="col-sm-2">
                                    <button type="button" class="btn btn-primary btn-block" onclick="appGaSave();">Submit</button>
                                </div>
                                <div class="col-sm-2">
                                    <button type="button" class="btn btn-default btn-block" onclick="cancel();" >Cancel</button>
                                </div>
    				        </div>
                        </div>                   
                    </div>
				</div>
			</div>
		</div>

</form>
</div>
